package com.ads.tpgrupo4.server.utils;

import java.util.List;

public class Assertions {
	
	private static final String EMPTY_STRING = "";

	public static void notNull(final Object obj, final String message) {
		
		if (obj == null) {
			throw new IllegalArgumentException(message);
		}
	}
	
	public static void notNullOrEmpty(final String value, final String message) {
		
		if (value == null || EMPTY_STRING.equals(value)) {
			throw new IllegalArgumentException(message);
		}
	}
	
	public static void notNullOrEmptyList(final List<?> list, final String message) {
		if (list == null || list.isEmpty()) {
			throw new IllegalArgumentException(message);
		}
	}
	
	public static void isFalse(final boolean expression, final String message) {
		if (expression) {
			throw new IllegalArgumentException(message);
		}
	}

	public static void isTrue(final boolean expression, final String message) {
		if (!expression) {
			throw new IllegalArgumentException(message);
		}
	}
	
}
